package com.dirox.plugins.issuetab;

import static com.google.common.base.Preconditions.checkNotNull;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.bc.issue.search.SearchService;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.issuetabpanel.AbstractIssueTabPanel;
import com.atlassian.jira.plugin.issuetabpanel.IssueTabPanel;
import com.atlassian.jira.project.ProjectManager;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.user.util.UserManager;
//import com.opensymphony.user.User;
import com.atlassian.crowd.embedded.api.User;
import com.dirox.plugins.ao.NoteService;
import com.dirox.plugins.issuetab.NoteIssueAction;

public class MyIssueTabPanel extends AbstractIssueTabPanel implements
		IssueTabPanel {
	private static final Logger log = LoggerFactory
			.getLogger(MyIssueTabPanel.class);
	private final JiraAuthenticationContext context;
	private IssueService issueService;
	private SearchService searchService;
	private ProjectManager projectManager;
	private  NoteService noteService;
	private  UserManager userManager;
	
	
	

	public MyIssueTabPanel(JiraAuthenticationContext context, IssueService issueService,
			SearchService searchService, ProjectManager projectManager,
			NoteService noteService, UserManager userManager) {
		super();
		this.context = context;
		this.noteService = checkNotNull(noteService);
		this.userManager = checkNotNull(userManager);
		this.searchService = checkNotNull(searchService);
		this.issueService = checkNotNull(issueService);
		this.projectManager = checkNotNull(projectManager);
	}

	public List getActions(Issue issue, User remoteUser) {
		List<NoteIssueAction> panelActions = new ArrayList<NoteIssueAction>();
		panelActions.add(new NoteIssueAction(descriptor, context, issueService, searchService, projectManager, noteService, userManager));
		return panelActions;
	}

	public boolean showPanel(Issue issue, User remoteUser) {
		return true;
	}
}
